<?php
	session_start();
	include("load-settings.php");

	if(!isset($_SESSION['user']))
		header("Location: login.php");

	$user = $_SESSION['user'];

	$result = mysql_query("SELECT * FROM user WHERE id = $user");
	$row = mysql_fetch_array($result);
	$access = $row['type'];

	if($access != 2)
		header("Location: home.php");

	$region = mysql_real_escape_string($_POST['region']);
	$referrals = mysql_real_escape_string($_POST['referrals']);

	$x = 0;

	$result = mysql_query("SELECT * FROM bulk_account WHERE region = '$region' AND used = 0 AND referrals = $referrals");

	while($row = mysql_fetch_array($result))
	{
		echo $row['username'].":".$row['password']."\n";
	}
?>